/**
*
* @title 不同遮罩层状态的模态框
* @description 遮罩层可以通过backdrop属性控制状态，可以为不响应事件，可以不显示。
*
*/

import React, { Component } from 'react';
import {base, ajax } from "nc-lightapp-front";
// import './Demo12.less';
import { Toast } from "antd-mobile";
import Table from './Table'

const {NCTable,NCMessage, NCButton, NCModal } = base;



class Demo12 extends Component {
  constructor(props) {
    super(props);
    this.state = {
      tcdata:{},
      showModal: false,
      modalDropup: true
    };
    this.changeDropup = this.changeDropup.bind(this);
  }


   close = () => {
    this.setState({
      showModal: false
    });
    this.props.changetca(false);
  };

  open = () => {
    this.setState({
      showModal: true
    });
  };

  changeDropup=(state)=> {
    this.setState({
      modalDropup: state
    });
  }
  componentWillReceiveProps(props) {
    let tca=props.tca;
    let data = props.tcdata;
    if (this.props.tcdata != "") {
      this.setState({tcdata:data});
    }
    this.setState({showModal:tca});
  }

  

  render() {
    console.log("showModel=>>>>>>>>>"+this.state.showModal);
    return (
      <div>
        <NCModal
          width="80%"
          height="60%"
          className="demo4-NCModal"
          show={this.state.showModal}
          backdrop={this.state.modalDropup}
          onHide={this.close}
        >
          <NCModal.Header closeButton>
            <NCModal.Title>相关凭证</NCModal.Title>
          </NCModal.Header>
          <NCModal.Body>
          <Table tcdata={this.props.tcdata}> </Table>
          </NCModal.Body>
          <NCModal.Footer>
            <NCButton colors="secondary" onClick={this.close} >
              关闭
            </NCButton>
          </NCModal.Footer>
        </NCModal>
      </div>
    );
  }
}
export default Demo12;